var o = require("../../res/www.a9a.cn.js"),
  t = getApp(),
  e = wx.getStorageSync("COOK_U");
Page({
  data: { topbar: ["全部", "男生", "女生"], currentTab: 0 },
  onLoad: function () {
    var e = this;
    t.get_config("_ZEAI").then(function (t) {
      e.setData({
        color: t.color,
        rgbcolor: o.c16_rgb(t.color),
        lovebname: t.loveb,
      });
    }),
      t.chklogin().then(function (o) {
        o
          ? t.get_openid().then(function (o) {
              t.ajax({
                url: "my_refresh.php",
                data: { submitok: "init", openid: o },
                success: function (o) {
                  1 == o.flag
                    ? e.setData({
                        ifshow: o.ifshow,
                        mc: o.mc,
                        loveb: o.loveb,
                        price: o.price,
                        LIST1: o.ARR1,
                        LIST2: o.ARR2,
                        LIST3: o.ARR3,
                      })
                    : "noreg" == o.flag
                    ? wx.redirectTo({ url: "../login/login" })
                    : wx.showToast({ title: o.msg, icon: "none", mask: !0 });
                },
              });
            })
          : wx.showModal({
              content: "亲~~~请先登录完善资料再来申请哦",
              confirmColor: e.data.color,
              confirmText: "朕知道了",
              showCancel: !1,
              success: function (o) {
                wx.redirectTo({ url: "../login/login" });
              },
            });
      });
  },
  topbarFn: function (o) {
    var t = parseInt(o.currentTarget.dataset.idx);
    this.setData({ currentTab: t });
  },
  moddataFn: function () {
    wx.navigateTo({ url: "../reg/reg" });
  },
  btnFn: function () {
    1 == this.data.ifshow
      ? this.data.price > 0
        ? wx.showModal({
            content:
              "确定提交么？\n刷新靠前一次需花费" +
              this.data.price +
              this.data.lovebname,
            confirmColor: this.data.color,
            cancelText: "取消",
            confirmText: "确定",
            success: function (o) {
              o.confirm &&
                t.ajax({
                  url: "my_refresh.php",
                  data: { submitok: "ajax_modupdate", openid: e.openid },
                  success: function (o) {
                    1 == o.flag
                      ? (wx.showToast({ title: o.msg, icon: "none", mask: !0 }),
                        setTimeout(function () {
                          wx.redirectTo({ url: "refresh" });
                        }, 2e3))
                      : wx.showToast({
                          title: o.msg,
                          duration: 4e3,
                          icon: "none",
                          mask: !0,
                        });
                  },
                });
            },
          })
        : t.ajax({
            url: "my_refresh.php",
            data: { submitok: "ajax_modupdate", openid: e.openid },
            success: function (o) {
              1 == o.flag
                ? (wx.showToast({ title: o.msg, icon: "none", mask: !0 }),
                  setTimeout(function () {
                    wx.redirectTo({ url: "refresh" });
                  }, 2e3))
                : wx.showToast({
                    title: o.msg,
                    duration: 4e3,
                    icon: "none",
                    mask: !0,
                  });
            },
          })
      : wx.showModal({
          content: "您无法使用此功能\n1．头像未上传\n2．资料不完善",
          confirmColor: this.data.color,
          confirmText: "朕知道了",
          showCancel: !1,
          success: function (o) {},
        });
  },
});
